<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
<div id="app">
    <!--1. .stop修饰符 停止冒泡 -->
    <div @click="divClick">
        aaaaaa
        <button @click.stop="btnClick">点击</button>
    </div>

    <!-- 2. .prevent修饰符 阻止默认行为 -->
    <form action="">
        <input type="submit" name="" id="" v-on:click.prevent="submitClick">
    </form>

    <!-- 3. 监听键盘的行为 -->
    <input type="text" v-on:keyup.enter="keyup">

    <!-- 4. 只触发一次回调 -->
    <button v-on:click.once="btn2Click">按钮2</button>
</div>

<script src="../js/vue.js"></script>
<script>
    const app = new Vue({
        el:'#app',
        methods: {
            btnClick(){
                console.log("btnClick");
            },
            divClick(){
                console.log("divClick");
            },
            submitClick(){
                console.log("submitClick");
            },
            keyup(){
                console.log("keyup");
            },
            btn2Click(){
                console.log("btn2Click");
            }
        },
    })
</script>
</body>
</html>